<?php
/**
 * Created by PhpStorm.
 * User: gm
 * Date: 2018/12/12
 * Time: 20:01
 */
include "config.php";
include "status.php";
$GID=$_REQUEST["gid"];
$UID=$_REQUEST["uid"];
$NUM=$_REQUEST["num"];
$sql="UPDATE cart SET c_num=?,c_total=c_num*c_price WHERE u_id=? AND g_id=?;";
$stmt=$conn->prepare($sql);
$stmt->bind_param("iii",$NUM,$UID,$GID);
$stmt->execute();

if($stmt->affected_rows>=1){
    print_r(json_encode(Status::$z_s));
}else{
    print_r(json_encode(Status::$z_f));
}